﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using dbPoll_Application.Models;

namespace dbPoll_Application.ViewModels
{
    public class EditParticipantViewModel
    {
        public int ParticipantID { get; set; }
        public String DeviceID { get; set; }
        public ParticipantGroup Group { get; set; }
        public String FirstName { get; set; }
        public String LastName { get; set; }
        public IList<ParticipantFieldValueViewModel> Fields { get; set; }
        public Entity Entity { get; set; }
        public int VotingWeight { get; set; }

        public EditParticipantViewModel()
        {
            this.ParticipantID = -1;
            this.DeviceID = String.Empty;
            this.Group = null;
            this.FirstName = String.Empty;
            this.LastName = String.Empty;
            this.Fields = null;
            this.Entity = null;
            this.VotingWeight = -1;
        }

        public EditParticipantViewModel(int participantID, String deviceID, ParticipantGroup group, String firstName, String lastName, IList<ParticipantFieldValueViewModel> fields, Entity entity, int votingWeight)
        {
            this.ParticipantID = participantID;
            this.DeviceID = deviceID;
            if (group == null)
            {
                group = new ParticipantGroup();
            }
            this.Group = group;
            this.FirstName = firstName;
            this.LastName = lastName;
            if (fields == null)
            {
                fields = new List<ParticipantFieldValueViewModel>();
            }
            this.Fields = fields;
            if (entity == null)
            {
                entity = new Entity();
            }
            this.Entity = entity;
            this.VotingWeight = votingWeight;
        }
    }
}
